package com.huifer.wgx.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Objects;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * <p>Title : InteriorLineEntity </p>
 * <p>Description : </p>
 *
 * @author huifer
 * @date 2019-03-20
 */
@Entity
@Table(name = "t_interior_line", schema = "at15", catalog = "")
public class InteriorLineEntity {

    private Long interiorLineId;
    private Long interiorLineStartPointId;
    private String interiorLineStartPointName;
    private BigDecimal interiorLineStartPointDeep;
    private Long interiorLineEndPointId;
    private String interiorLineEndPointName;
    private BigDecimal interiorLineEndPointDeep;
    private String interiorLineDs;
    private String interiorLineMaterial;
    private Long workId;
    private Long personnelId;
    private String interiorLineType;
    private Collection<DetectionLineEntity> tDetectionLinesByInteriorLineId;
    private InteriorPointEntity tInteriorPointByInteriorLineStartPointId;
    private InteriorPointEntity tInteriorPointByInteriorLineEndPointId;
    private WorkEntity tWorkByWorkId;
    private PersonnelEntity tPersonnelByPersonnelId;

    @Id
    @Column(name = "interior_line_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public Long getInteriorLineId() {
        return interiorLineId;
    }

    public void setInteriorLineId(Long interiorLineId) {
        this.interiorLineId = interiorLineId;
    }

    @Basic
    @Column(name = "interior_line_type")
    public String getInteriorLineType() {
        return interiorLineType;
    }

    public void setInteriorLineType(String interiorLineType) {
        this.interiorLineType = interiorLineType;
    }

    @Basic
    @Column(name = "interior_line_ds")
    public String getInteriorLineDs() {
        return interiorLineDs;
    }

    public void setInteriorLineDs(String interiorLineDs) {
        this.interiorLineDs = interiorLineDs;
    }

    @Basic
    @Column(name = "interior_line_material")
    public String getInteriorLineMaterial() {
        return interiorLineMaterial;
    }

    public void setInteriorLineMaterial(String interiorLineMaterial) {
        this.interiorLineMaterial = interiorLineMaterial;
    }

    @Basic
    @Column(name = "interior_line_start_point_id")
    public Long getInteriorLineStartPointId() {
        return interiorLineStartPointId;
    }

    public void setInteriorLineStartPointId(Long interiorLineStartPointId) {
        this.interiorLineStartPointId = interiorLineStartPointId;
    }

    @Basic
    @Column(name = "interior_line_start_point_name")
    public String getInteriorLineStartPointName() {
        return interiorLineStartPointName;
    }

    public void setInteriorLineStartPointName(String interiorLineStartPointName) {
        this.interiorLineStartPointName = interiorLineStartPointName;
    }

    @Basic
    @Column(name = "interior_line_start_point_deep")
    public BigDecimal getInteriorLineStartPointDeep() {
        return interiorLineStartPointDeep;
    }

    public void setInteriorLineStartPointDeep(BigDecimal interiorLineStartPointDeep) {
        this.interiorLineStartPointDeep = interiorLineStartPointDeep;
    }

    @Basic
    @Column(name = "interior_line_end_point_id")
    public Long getInteriorLineEndPointId() {
        return interiorLineEndPointId;
    }

    public void setInteriorLineEndPointId(Long interiorLineEndPointId) {
        this.interiorLineEndPointId = interiorLineEndPointId;
    }

    @Basic
    @Column(name = "interior_line_end_point_name")
    public String getInteriorLineEndPointName() {
        return interiorLineEndPointName;
    }

    public void setInteriorLineEndPointName(String interiorLineEndPointName) {
        this.interiorLineEndPointName = interiorLineEndPointName;
    }

    @Basic
    @Column(name = "interior_line_end_point_deep")
    public BigDecimal getInteriorLineEndPointDeep() {
        return interiorLineEndPointDeep;
    }

    public void setInteriorLineEndPointDeep(BigDecimal interiorLineEndPointDeep) {
        this.interiorLineEndPointDeep = interiorLineEndPointDeep;
    }

    @Basic
    @Column(name = "work_id")
    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    @Basic
    @Column(name = "personnel_id")
    public Long getPersonnelId() {
        return personnelId;
    }

    public void setPersonnelId(Long personnelId) {
        this.personnelId = personnelId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        InteriorLineEntity that = (InteriorLineEntity) o;
        return Objects.equals(interiorLineId, that.interiorLineId) &&
                Objects.equals(interiorLineStartPointId, that.interiorLineStartPointId) &&
                Objects.equals(interiorLineStartPointName, that.interiorLineStartPointName) &&
                Objects.equals(interiorLineStartPointDeep, that.interiorLineStartPointDeep) &&
                Objects.equals(interiorLineEndPointId, that.interiorLineEndPointId) &&
                Objects.equals(interiorLineEndPointName, that.interiorLineEndPointName) &&
                Objects.equals(interiorLineEndPointDeep, that.interiorLineEndPointDeep) &&
                Objects.equals(workId, that.workId) &&
                Objects.equals(personnelId, that.personnelId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(interiorLineId, interiorLineStartPointId, interiorLineStartPointName,
                interiorLineStartPointDeep, interiorLineEndPointId, interiorLineEndPointName,
                interiorLineEndPointDeep, workId, personnelId);
    }

    @OneToMany(mappedBy = "tInteriorLineByInteriorLineId")
    @JsonIgnore
    public Collection<DetectionLineEntity> gettDetectionLinesByInteriorLineId() {
        return tDetectionLinesByInteriorLineId;
    }

    public void settDetectionLinesByInteriorLineId(
            Collection<DetectionLineEntity> tDetectionLinesByInteriorLineId) {
        this.tDetectionLinesByInteriorLineId = tDetectionLinesByInteriorLineId;
    }

    @ManyToOne
    @JoinColumn(name = "interior_line_start_point_id", referencedColumnName = "interior_point_id", insertable = false, updatable = false)
    public InteriorPointEntity gettInteriorPointByInteriorLineStartPointId() {
        return tInteriorPointByInteriorLineStartPointId;
    }

    public void settInteriorPointByInteriorLineStartPointId(
            InteriorPointEntity tInteriorPointByInteriorLineStartPointId) {
        this.tInteriorPointByInteriorLineStartPointId = tInteriorPointByInteriorLineStartPointId;
    }

    @ManyToOne
    @JoinColumn(name = "interior_line_end_point_id", referencedColumnName = "interior_point_id", insertable = false, updatable = false)
    public InteriorPointEntity gettInteriorPointByInteriorLineEndPointId() {
        return tInteriorPointByInteriorLineEndPointId;
    }

    public void settInteriorPointByInteriorLineEndPointId(
            InteriorPointEntity tInteriorPointByInteriorLineEndPointId) {
        this.tInteriorPointByInteriorLineEndPointId = tInteriorPointByInteriorLineEndPointId;
    }

    @ManyToOne
    @JoinColumn(name = "work_id", referencedColumnName = "work_id", insertable = false, updatable = false)
    public WorkEntity gettWorkByWorkId() {
        return tWorkByWorkId;
    }

    public void settWorkByWorkId(WorkEntity tWorkByWorkId) {
        this.tWorkByWorkId = tWorkByWorkId;
    }

    @ManyToOne
    @JoinColumn(name = "personnel_id", referencedColumnName = "personnel_id", insertable = false, updatable = false)
    public PersonnelEntity gettPersonnelByPersonnelId() {
        return tPersonnelByPersonnelId;
    }

    public void settPersonnelByPersonnelId(PersonnelEntity tPersonnelByPersonnelId) {
        this.tPersonnelByPersonnelId = tPersonnelByPersonnelId;
    }
}
